const db = require('../../db/sql')
const {delay} = require('../../utils/delay')

function modifyMenu(params,res){
    console.log(params,'说到哪里')
    let {parent_id,rank_id,menu_name,path_name,rank_name} =params

    if (parent_id=='null'||parent_id.length==0){
        parent_id ='null'
        rank_name = '一级菜单'
    }
    console.log(rank_name,'利用')
    let sql = `update menulist set parent_id =${parent_id},menu_name='${menu_name}',
           rank_name='${rank_name}',path_name='${path_name}' where rank_id =${rank_id}`
    db.query(sql,(err,res1)=>{
        if (err){
            console.log(err)
            throw err
        }
        res.status(201).send({
            msg:'修改成功'
        })
    })
}
 module.exports =modifyMenu
